package com.atguigu.lease.web.app.service.impl;

import com.atguigu.lease.common.context.LoginUser;
import com.atguigu.lease.common.context.LoginUserContext;
import com.atguigu.lease.model.entity.*;
import com.atguigu.lease.web.app.mapper.*;
import com.atguigu.lease.web.app.service.LeaseAgreementService;
import com.atguigu.lease.web.app.vo.agreement.AgreementItemVo;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author liubo
 * @description 针对表【lease_agreement(租约信息表)】的数据库操作Service实现
 * @createDate 2023-07-26 11:12:39
 */
@Service
public class LeaseAgreementServiceImpl extends ServiceImpl<LeaseAgreementMapper, LeaseAgreement>
        implements LeaseAgreementService {


    @Resource
    private UserInfoMapper userInfoMapper;

    @Resource
    private LeaseAgreementMapper leaseAgreementMapper;

    @Override
    public List<AgreementItemVo> listItem() {
        LoginUser loginUser = LoginUserContext.getLoginUser();
        UserInfo userInfo = userInfoMapper.selectById(loginUser.getUserId());
        return leaseAgreementMapper.selectListByUserPhone(userInfo.getPhone());
    }
}




